package com.example.administrator.systemfailreport.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.administrator.systemfailreport.R;

import java.util.List;

import entity.SysErrorEntity;

/**
 * Created by Administrator on 2017/2/16.
 */
public class SysErrorFragAdapter extends BaseAdapter{
    List<SysErrorEntity> data;
    Context context;
    LayoutInflater inflater;

    public SysErrorFragAdapter(Context context,List<SysErrorEntity> data){
        this.data=data;
        inflater=LayoutInflater.from(context);
        this.context=context;
    }
    @Override
    public int getCount() {
        return data.size();
    }

    @Override
    public Object getItem(int position) {
        return data.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        SysErrorEntity item = data.get(position);
        MyHolder h=null;
        if(convertView==null){
            convertView=inflater.inflate(R.layout.item_record_list,parent,false);
            h=new MyHolder();
            h.baseTitle=(TextView)convertView.findViewById(R.id.basicData);
            h.confirmDate=(TextView)convertView.findViewById(R.id.confimDate);
            convertView.setTag(h);
        }else{
            h=(MyHolder)convertView.getTag();
        }
        return convertView;
    }

    class MyHolder{
          TextView baseTitle;
          TextView confirmDate;
    }
}
